<?php
$dsn = "mysql:host=127.0.0.1;dbname=blog";
$db = new PDO($dsn, "root", "123456");
$db->exec("set names utf8mb4");

// 查询分类列表
$sql = "SELECT * FROM category order by category_id desc";
$result = $db->query($sql);
$categoryList = $result->fetchAll(PDO::FETCH_ASSOC);

// 查询文章详情
$sql = "SELECT * FROM article where article_id='$articleId'";
$result = $db->query($sql);
$article = $result->fetch(PDO::FETCH_ASSOC);